package com.wanhong.springboot.ssm.framework.pool;

import java.util.Optional;
import java.util.concurrent.*;

public class MyThreadPool{

    private static MyThreadPool instance;

    private MyThreadPool() {
    }

    public static MyThreadPool getInstance(){
        if(instance==null){
            instance =new MyThreadPool();
        }
        return instance;

    }

    public static ExecutorService executorService = new ThreadPoolExecutor(
            16,200,60, TimeUnit.SECONDS,
            new LinkedBlockingDeque<>(100),new SimpleThreadFactory()
            , new ThreadPoolExecutor.CallerRunsPolicy());

    static class SimpleThreadFactory implements ThreadFactory {
        public Thread newThread(Runnable r) {
            return new Thread(r);
        }


    }


}
